// map.h
// map class header file

#ifndef MAP_H
#define MAP_H

#include <SDL/SDL.h>

class Map {
	public:
		Map();
		~Map();
		
		void setSize(const unsigned int, const unsigned int);
		
		void initialise();
		void uninitialise();
		
		bool load(char*);
		bool save(char*);
		
		unsigned int getWidth();
		unsigned int getHeight();
		
		unsigned char getTile(const unsigned int, const unsigned int,
		                      const unsigned int);
		void setTile(const unsigned int, const unsigned int, const unsigned int,
		             const unsigned char);
		
		void drawEarth();
		void drawEarth(const unsigned int, const unsigned int);
		void drawWater();
		void drawWater(const unsigned int, const unsigned int);
		
		void subdivideDisplace(unsigned int, const float, const unsigned int);
		void offsetArea(const float, const float, const float, const float);
		
		unsigned char*** getMapData();

		void nextFrame();

	private:
		bool initialised_;
		
		unsigned int width_;
		unsigned int height_;
		unsigned int waterFrame_;
		
		unsigned char ***map_;
		
		SDL_Surface* whiteMask_;
		SDL_Surface* grass_;
		SDL_Surface* water_[32];
};

#endif // MAP_H
